package com.yongqi.duocai.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yongqi.duocai.entity.Order;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yongqi.duocai.entity.result.OrderInfoResult;
import com.yongqi.duocai.entity.result.OrderResult;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 夏亮辉
 * @since 2021-06-24
 */

@Repository
public interface OrderMapper extends BaseMapper<Order> {

    /**
     * 根据用户 id 及条件信息查询订单信息
     * @param userId
     * @return
     */
    List<OrderResult> selectByUserId(@Param("userId") Integer userId, @Param("condition") String conditon, @Param("no") String no);


    /**
     * 根据用户 id 查询订单信息[没有发票抬头]
     * @param userId
     * @return
     */
    IPage<OrderResult> selectByUserIdByPage(IPage<OrderResult> page, @Param("userId") Integer userId, @Param("state") Integer state);


    /**
     * 根据订单号查询商品信息详情
     * @param userId
     * @param no
     * @return
     */
    List<OrderInfoResult> queryByNo(@Param("userId") Integer userId, @Param("no") String no);
}
